/**
 * 2013-6-26 上午12:20:59 Created By niexiaoqiang
 */

package com.xiaoqiang.MtwV2ForMoblie.update;

import android.os.Handler;

import com.xiaoqiang.util.download.DownLoadObjectInfo;
import com.xiaoqiang.util.download.event.DownLoadSizeChangedEvent;
import com.xiaoqiang.util.download.listener.DownLoadSizeChangedListener;

/**
 * 下载APK监听器
 */
public class DownloadDialogApkDownLoadSizeChangedListener implements DownLoadSizeChangedListener {
	private Handler handle;

	public DownloadDialogApkDownLoadSizeChangedListener(DownloadDialog downDialog) {
		this.handle = downDialog.handle;
	}

	@Override
	public void downLoadSizeChanged(DownLoadSizeChangedEvent event) {
		DownLoadObjectInfo downLoadObjectInfo = event.getDownLoadObjectInfo();
		if ("MtwV2ForMoblie.apk".equals(downLoadObjectInfo.getFilename())) {
			DownloadMessage downloadMessage = new DownloadMessage(downLoadObjectInfo.getFilename(), downLoadObjectInfo.getFilesize(), downLoadObjectInfo.getDownloadsize());
			handle.sendMessage(downloadMessage.getMessage());
		}
	}
}
